#include "Module.h"
#include "Rect.h"
#include "Texture.h"
#include "Vector.h"
#include "Utils.h"

Module::Module(int x, int y, int width, int height, Texture* texture)
{
	rSrc = new Rect(x, y, width, height);
	this->texture = texture;
	posInRect = new Vector(0.0f, 0.0f);
}

Module::Module(int x, int y, int width, int height, Texture* texture, int xInSprite, int yInSprite)
{
	rSrc = new Rect(x, y, width, height);
	this->texture = texture;
	posInRect = new Vector(xInSprite, yInSprite);
}

void Module::Render(int x, int y, float deep)
{
	texture->Render(x, y, rSrc, deep);
}

void Module::Render(int x, int y, float alpha, float deep)
{
	texture->Render(x, y, rSrc, alpha, deep);
}

void Module::Render(int x, int y, float xScale, float yScale, float angle, float alpha,float deep)
{
	texture->Render(x, y, rSrc, xScale, yScale, angle, alpha, deep);
}

Module::~Module()
{
	DELETE_SAFELY(rSrc);
	DELETE_SAFELY(posInRect);
}